﻿using System;

namespace nyxwin.Common.Base.Utils
{
	public class NickN
	{
		private readonly string serverNick = string.Empty;

		public NickN(string serverNick)
		{
			this.serverNick = serverNick;
		}

		public static implicit operator String(NickN nick)
		{
			return nick.serverNick;
		}

		public static implicit operator Uri(NickN nick)
		{
			if (string.IsNullOrEmpty(nick.serverNick))
				throw new ArgumentNullException("ServerNick is null or empty!");

			string nickUp = nick.serverNick.ToUpper();
			return new Uri(string.Format("http://i.nyx.cz/{0}/{1}.gif", nickUp[0], nickUp), UriKind.Absolute);
		}
	}
}